package hjslm.Controller.Front;

import java.util.List;

import hjslm.Bean.NavcustomBean;
import hjslm.Bean.XinwenBean;
import hjslm.Service.INavCustomService;
import hjslm.Service.IWeixinService;
import hjslm.Service.IXinwenService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import framework.base.common.Pager;
import framework.base.controller.BaseController;

@Controller
@RequestMapping("/news")
public class FXinwenController extends BaseController{

	/**
	 * 新闻动态
	 */
	private static final long serialVersionUID = 1L;
	
	@Autowired
	INavCustomService navCustomService;
	
	@Autowired
	IXinwenService xinwenService;
	
	@Autowired
	IWeixinService weixinService;

	@Override
	public void setLogger() {
		// TODO Auto-generated method stub
	}
	
	@RequestMapping("/index")
	public ModelAndView index(XinwenBean bean,Pager<XinwenBean> pager){
		ModelAndView modelAndView = new ModelAndView("front/xinwen/index");
		pager.setCountPerPage(20);
		pager = xinwenService.selectPage(bean, pager);
		modelAndView.addObject("pager", pager);
		
		modelAndView.addObject("map", weixinService.selectMap());
		List<NavcustomBean> navList  = navCustomService.selectList(null);
		modelAndView.addObject("navList", navList);
		
		return modelAndView;
	}
	
	@RequestMapping("/info")
	public ModelAndView info(XinwenBean bean){
		ModelAndView modelAndView = new ModelAndView("front/xinwen/info");
		bean = xinwenService.selectOne(bean);
		modelAndView.addObject("bean", bean);
		
		modelAndView.addObject("map", weixinService.selectMap());
		List<NavcustomBean> navList  = navCustomService.selectList(null);
		modelAndView.addObject("navList", navList);
		
		return modelAndView;
	}
	

}
